package ro.myApp.security.client;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.security.Identity;

import ro.myApp.client.BaseView;
import ro.myApp.security.dto.UserFindByUsernameMessage;
import ro.myApp.security.entities.User;


@Name("manageAccount")
@BypassInterceptors
@Scope(ScopeType.PAGE)
public class ManageAccount extends BaseView {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4005698645989302054L;

	private User instance;
	
	@Create
	public void checkUser(){
		instance = sendMessage(new UserFindByUsernameMessage(
				Identity.instance().getCredentials().getUsername()));
	}
	
	public User getInstance() {
		return instance;
	}
	
	public void setInstance(User instance) {
		this.instance = instance;
	}
}
